#include <iostream>
using namespace std;

const int N = 1e4 + 10;

int n, cnt, arr[N];

int main()
{
	int max = 0;
	
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> arr[i];
	
	for (int i = 1; i <= n; i++)
	{
		if (arr[i + 1] - arr[i] == 1)
			cnt++;
		else
			cnt = 0;
		if (cnt > max)
			max = cnt;
	}
	
	cout << ++max << endl;
	
	return 0;
}
